
package api.commonAPI;

import android.content.Context;

import java.lang.ref.SoftReference;

/**
 * china_lib
 * 
 * @author daihui
 */
public abstract class BDUpdateAPI {

    public abstract void update(Context act);
    public static String clazz = "api.commonAPI.BaiduUpdate";

    private static SoftReference<BDUpdateAPI> sf;

    /**
     * UmengUpdate in all 一般情况, 如有特例单独处理
     * @return
     */
    public synchronized static BDUpdateAPI getInstance() {
        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                sf = new SoftReference<BDUpdateAPI>((BDUpdateAPI) o);
                return (BDUpdateAPI) o;
            }
        }
        return sf == null ? null : sf.get();
    }
}
